package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.BusinessDay;

/**
 * QBusinessDay is a ORMLite query type for BusinessDay
 * @see BusinessDay
 */
public class QBusinessDay extends QEntityBase<BusinessDay> {

    public static final QBusinessDay $ = new QBusinessDay("BUSINESS_DAY");

    public final Column bizDate = field("bizDate").columnName("BIZ_DATE").localDate().notNull().build();

    public final Column shopId = field("shopId").columnName("SHOP_ID").varchar(22).notNull().build();

    public class Indexs {

        public final Index primaryKey6 = index("PRIMARY_KEY_6").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QBusinessDay(String tableName) {
        super(BusinessDay.class, tableName);
    }

    @Override
    public BusinessDay newInstance() {
        return new BusinessDay();
    }

    @Override
    public Object getFieldValue(BusinessDay instance, String fieldName) {
        switch (fieldName) {
            case "bizDate":
                return instance.getBizDate();
            case "shopId":
                return instance.getShopId();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(BusinessDay instance, String fieldName, Object value) {
        switch (fieldName) {
            case "bizDate":
                instance.setBizDate((java.time.LocalDate) value);
                break;
            case "shopId":
                instance.setShopId((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

